<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/10/12 0012
 * Time: 下午 6:36
 */
namespace app\article\validate;
class ValiCp {
    const errmsg=[
        'id.require'        =>10011,#缺少参数
        'id.checkId'        =>10011,
        'title.require'     =>10014,#标题不能为空
        'title.max'         =>10014,#标题不能为空
        'content.require'   =>10015,#标题不能为空
        'pid.require'       =>10018,#分类不能为空
        'img.require'       =>10017,#缩略图不能为空
        'userid.require'    =>10011,#缺少参数
        'userid.checkId'    =>10024,#用户暂未发表文章

    ];

    static function cp_info_list(){
        $rule = [
            'id'=>'require|checkId'
        ];
        $message = self::errmsg;
        return ['rule'=>$rule,'message'=>$message];
    }

    static function cp_add(){
        $rule = [
            'title'=>'require|max:50',
            'pid'=>'require',
            'content'=>'require',
            'img'=>'require',
        ];
        $message = self::errmsg;
        return ['rule'=>$rule,'message'=>$message];
    }

    static function cp_update(){
        $rule = [
            'id'=>'require',
            'title'=>'require',
            'pid'=>'require',
            'content'=>'require',
        ];
        $message = self::errmsg;
        return ['rule'=>$rule,'message'=>$message];
    }

    static function cp_type(){
        $rule = [
            'userid'=>'require|checkId'
        ];
        $message = self::errmsg;
        return ['rule'=>$rule,'message'=>$message];
    }
}